#ifndef		__OMNI_STORAGE_H_INCLUDED__
#define		__OMNI_STORAGE_H_INCLUDED__

#include	<ctime>
#include	<map>
#include	<string>

class Storage {
	struct StorageData {
		std::string	sValue;
		time_t		nExpire;
	};

	typedef std::map<std::string, StorageData> Cache;

public:
	Storage() : _nExpire(900), _mCache() {}

	static Storage &	Get();

	void		SetExpire(int nExpire) { _nExpire = nExpire; }
	int			GetExpire() const { return _nExpire; }
	std::string Get(const std::string & sKey);
	void		Set(const std::string & sKey, const std::string & sValue, bool bNeverExpire = false);

private:
	int		_nExpire;
	Cache	_mCache;
};

#endif//!	__OMNI_STORAGE_H_INCLUDED__
